package com.qf.Service.impl;

import com.qf.Dao.PatientInfoDao;
import com.qf.Dao.impl.PatientInfoDaoImpl;
import com.qf.Service.PatientInfoService;
import com.qf.entity.PatientInfo;

import java.sql.SQLException;
import java.util.List;

public class PatientInfoServiceImpl implements PatientInfoService {
    private PatientInfoDao patientInfoDao = new PatientInfoDaoImpl();


    @Override
    public List<PatientInfo> selectPatientInfo(String name) {
        try {
            return patientInfoDao.selectPatientInfo(name);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public int addPatientInfo(PatientInfo patientInfo) {
        try {
            return patientInfoDao.addPatientInfo(new PatientInfo());
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return -1;
    }

    @Override
    public int deletePatientInfo(String name){
        try {
            return patientInfoDao.deletePatientInfo(name);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return -1;
    }

    @Override
    public int updatePatientInfo(PatientInfo patientInfo) {
        try {
            return patientInfoDao.updatePatientInfo(patientInfo);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return -1;
    }
}
